#ifndef INPUTHANDLER_H
#define INPUTHANDLER_H

#include <event/events.h>
#include <input/input.h>

// Dear God, if you touch these constants, I will hunt you down
// and wear your skin as a hat.

const unsigned long ID_MOUSE    = 0X00;
const unsigned long ID_KEYBOARD = 0X01;
#define ID_JOYSTICK(n) ((unsigned long)(n + 2))

const unsigned long IE_XAXIS   = 0x0000;
const unsigned long IE_NXAXIS  = 0x0100;
const unsigned long IE_YAXIS   = 0x0200;
const unsigned long IE_NYAXIS  = 0x0300;
const unsigned long IE_ZAXIS   = 0x0400;
const unsigned long IE_NZAXIS  = 0x0500;
const unsigned long IE_RXAXIS  = 0x0600;
const unsigned long IE_NRXAXIS = 0x0700;
const unsigned long IE_RYAXIS  = 0x0800;
const unsigned long IE_NRYAXIS = 0x0900;
const unsigned long IE_RZAXIS  = 0x0a00;
const unsigned long IE_NRZAXIS = 0x0b00;
const unsigned long IE_POV_0   = 0x0c00;
const unsigned long IE_POV_1   = 0x0d00;
const unsigned long IE_POV_2   = 0x0e00;
const unsigned long IE_POV_3   = 0x0f00;
const unsigned long IE_POV_4   = 0x1000;
const unsigned long IE_POV_5   = 0x1100;
const unsigned long IE_POV_6   = 0x1200;
const unsigned long IE_POV_7   = 0x1300;
#define IE_BUTTON(n) (((unsigned long)(n + 0x14)) * 0x0100)

const unsigned long IA_PRESS   = 0x000000;
const unsigned long IA_RELEASE = 0x010000;

// for keys, they are just numbered. no fancy codes.

long InitInputHandler();
long DestroyInputHandler();

void HandleInput();

void DoEvents(unsigned long input);

unsigned long InputDataToInputEvent(const InputData * data);

void RegisterInputEvent(unsigned long input, events::Event * event);

//TODO: RemoveInputEvent(unsigned long input, events::Event * event);

#endif
